#ifndef __CM_NAT_JINGLE_EXTENSION_H__
#define __CM_NAT_JINGLE_EXTENSION_H__

#include "iqhandler.h"
#include "Content.h"
#include "Reason.h"

namespace cm_nat
{
    using namespace cm_xmpp;

    class JingleExtension: public StanzaExtension
    {
    public:
        JingleExtension( const Tag* tag = NULL );
        ~JingleExtension();

        void setSessionID(const std::string &sid);
        std::string getSessionID();

        void setInitiator(const std::string &initiator);
        std::string getInitiator();

        void setResponder(const std::string &responder);
        std::string getResponder();

        void setAction(const std::string &action);
        std::string getAction();

        bool addContent( Content* p_content );

        bool parse(const Tag* p_tag);
        // reimplemented from StanzaExtension
        virtual const std::string& filterString() const;

        // reimplemented from StanzaExtension
        virtual StanzaExtension* newInstance( const Tag* tag ) const
        {
            return new JingleExtension( tag );
        }

        // reimplemented from StanzaExtension
        virtual Tag* tag() const;

        // reimplemented from StanzaExtension
        virtual StanzaExtension* clone() const
        {
            JingleExtension* p = new JingleExtension();
            return p;
        }
    private:
        //attributes
        std::string m_action;
        std::string m_initiator;
        std::string m_responder;
        std::string m_sid;
        
        //elements
        ContentList m_contents;
        Reason* m_reason;

        //pre-parse
        Tag*  m_jingleTag;

        friend class JingleManager;
        friend class Jingle;
    };

}
#endif